﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		PluralizedTablesPack.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            PluralizedTablesPack.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using System.Collections.Generic;
using ConfOrm;
using ConfOrm.NH;
using ConfOrm.Shop.Inflectors;
using Dexter.Repository.NHibernate.Configuration;
using NHibernate.Mapping.ByCode;

namespace Dexter.Repository.NHibernate.ConfORM.DexterNaming {
	internal class PluralizedTablesPack : EmptyPatternsAppliersHolder {
		INHibernateConfiguration configuration;
		public PluralizedTablesPack ( IDomainInspector domainInspector , IInflector inflector , INHibernateConfiguration configuration ) {
			if ( domainInspector == null ) {
				throw new ArgumentNullException ( "domainInspector" );
			}

			if ( inflector == null ) {
				throw new ArgumentNullException ( "inflector" );
			}

			base.rootClass = new List <IPatternApplier <Type , IClassAttributesMapper>> {
				new ClassPluralizedTableApplier ( inflector ,configuration)
			};

			base.joinedSubclass = new List<IPatternApplier<Type, IJoinedSubclassAttributesMapper>> {
				new JoinedSubclassPluralizedTableApplier ( inflector,configuration )
			};

			base.unionSubclass = new List<IPatternApplier<Type, IUnionSubclassAttributesMapper>> {
				new UnionSubclassPluralizedTableApplier ( inflector ,configuration)
			};

			base.collectionPath = new List<IPatternApplier<PropertyPath, ICollectionPropertiesMapper>> {
				new ManyToManyPluralizedTableApplier ( domainInspector , inflector ,configuration)
			};
			this.configuration = configuration;
		}
	}
}
